Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export dist/es/index.d.ts files for use with Volar #2513

Closed
wants to merge 1 commit into from

Conversation

duncanfinney
Copy link

@duncanfinney duncanfinney commented Oct 12, 2023

Description of Changes

image

Current Workaround

  • yarn add --dev @types/turf
  • This is kind of confusing because the micro-packages like @turf/intersect should be in the typing package @types/turf__intersect package for the auto search to work

Checklist

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Have read How To Contribute.
  • Run npm test at the sub modules where changes have occurred.
  • Run npm run lint to ensure code style at the turf module level.

@smallsaucepan
Copy link
Member

Hi @duncanfinney . Thanks for this. Are there any downsides you can see, or things we might need to mention in the documentation? For example would we need to advise anyone who hast the @types/turf workaround installed to remove it?

@smallsaucepan
Copy link
Member

Took a closer look at the error message and think we might need to look into this in more detail.

The message says:

There are types at ‘/home/…/@turf/intersect/dist/js/index.d.ts, but this result could not be resolved when respecting package.json “exports”.

To summarise, the types are in the package, referenced from the "types" field in package.json which is as it should be. Volar finds them, but some other configuration prevents it resolving them confidently. Does that sound accurate to you?

Rather than duplicate the d.ts in the package, I'd lean more towards correcting the exports field (if that's the issue) so that Volar can be confident to use the types it does find. Are you open to doing a little hacking about in your local node_modules directory to try a few options?

@smallsaucepan
Copy link
Member

@duncanfinney going to retire this PR in favour of #2555 which should have Turf export declaration files more predictably and consistently. Once the next alpha drops (alpha.3 by my count) please give it a try and raise an issue if you run into problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants